<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title></title>
		
		<script th:src="@{/layui/layui.js}" type="text/javascript"></script>
		<link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
	</head>
	<body>
	<div class="layui-row">	
	    <div class="layui-panel layui-col-md12" style="padding: 8px;">
	        <div class="">
	            <table id="msgTable" lay-filter="msgTable"></table>
	        </div>
		</div>
		<!--<div class="layui-panel layui-col-md4" style="padding: 0px;">
	        <div>
	            <div class="layui-card" style="position: relative;">
	                <div class="layui-card-header layui-bg-cyan">权限分配</div>
	                <div class="layui-card-body">
	                	
	                    <div id="menuTree" class="layui-tree"></div>
	                    
	                </div>
	            </div>
	            <div class="layui-bg-gray" style="bottom: 0px;background-color: #fff;padding-top: 10px;
	            	position: absolute;height: 50px;width: 100%;text-align: center;left: 0px;">
	                <a class="layui-btn layui-btn-normal" lay-event="saveGrant">提交保存</a>
	                <a class="layui-btn layui-btn-primary" lay-event="clearCheck">清除选中</a>
	            </div>
	        </div>
	        
		</div>-->
	</div>
    <script id="tableBar" type="text/html">
        <a class="layui-btn layui-btn-normal layui-btn-md" lay-event="add">
            <i class="layui-icon layui-icon-add-1"></i>
            新增信息
        </a>
        
    </script>
    
    <script>
        var data =  [
        {"type":"sms","acceptUser":"123","title":"CS而","content":"123","sendTime":"2021-09-16 10:24","state":"0"},
        {"type":"email","acceptUser":"123","title":"CS而","content":"123","sendTime":"2021-09-16 10:24","state":"0"}
        ]
        var $;
        layui.use(['table','form','layer','jquery'],function () {
            var table = layui.table;
			$ = layui.jquery;
			setHeight();
            table.render({
                elem:'#msgTable',
                height:'full-100',
                page:true,
                url:'/system/smc/find',
                toolbar:'#tableBar',
                where:{
                    status:0
                },
				cols:[
					[
						{type:'numbers',fixed:'left'},
						{type:'checkbox',fixed:'left'},
						{field:'type',title:'信息类型',width:150,
							templet:function (res) {
								if("sms" == res.type){return "短信"}
								return "邮箱";
							}
						},
						{field:'acceptUser',title:'信息接收人',width:100},
						{field:'title',title:'信息标题',width:200},
						{field:'content',title:'信息内容',minWidth:150},
						{field:'sendTime',title:'发送时间',width:180},
						{field:'state',title:'发送状态',width:100,templet:'#switchState'},
					]
				]
            });
        
        
        	table.on('toolbar(msgTable)',function(obj){
        		var event = obj.event;
        		var b=false;
        		if('add' == event){
        			top.layer.open({
        				title:'新增信息发送',
        				type:2,
        				content:'/page/system/sendMessageAdd',
        				area:['800px','600px'],
        				btn:['确定提交','取消关闭'],
						btn1:function (i,o) {
							b = true;
							o.find('iframe')[0].contentWindow.btnSubmit();
						},
						end:function () {
							if(b) layui.table.reload('msgTable');
						}
        			})
        		}
        	});
        });
        
        //获取页面高度
		function setHeight(){
			var height = window.outerHeight-258;
			$('.layui-panel').css('height',height);
		}
    </script>
</body>

</html>
